package com.unswift.window.listener;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JButton;

import com.unswift.utils.ThreadUtils;
import com.unswift.window.factory.ButtonFactory;

public class ButtonActionListener implements ActionListener{
	
	private Object[] comps;
	
	public ButtonActionListener(Object...comps) {
		this.comps=comps;
	}

	@Override
	public synchronized void actionPerformed(ActionEvent e) {
		ThreadUtils.execute(new Runnable() {
			@Override
			public void run() {
				ButtonFactory.executeButton((JButton)e.getSource(), e.getActionCommand(), comps);
			}
		});
	}
	
}
